// -*- coding: iso-8859-1 -*-
/*
 *   Author: mous16 <mous16@gmail.org>
 *   Date: Thu Sep 27 2012, 12:09:46
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as
 *   published by the Free Software Foundation; either version 2 or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

import QtQuick 1.1
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.plasma.core 0.1 as PlasmaCore
import "../ui/"

Item {
    id: mainItem

    PlasmaCore.DataSource {
        id: tasksSource
        // interval:
        engine: "tasks"
        connectedSources: sources
        // sourceFilter:
        
    }

    PlasmaCore.DataSource {
        id: activitiesSource
        // interval:
        engine: "org.kde.activities"
        connectedSources: sources 
        //sourceFilter: ".*-.*"
        
    }

    PlasmaCore.DataModel {
        id: tasksModel
        dataSource: tasksSource
    }

    PlasmaCore.DataModel {
        id: activitiesModel
        dataSource: activitiesSource
        sourceFilter: ".*-.*"    
    }

    anchors.fill: parent
    GridView {
        id:test
        anchors.fill: parent
        model: tasksModel
        cellWidth: mainItem.width/10
        cellHeight: mainItem.height
        delegate: TaskDelegate{
            source: model["DataEngineSource"]
            label: model["visibleName"]
            icon: model["icon"]
            active: model["active"]
            minimized: model["minimized"]
            maximized: model["maximized"]
            showLabel: true
            showControls: true
            width: test.cellWidth
            height: test.cellHeight
            orientation: "UP"
        }
//         delegate: TaskDelegateDev{
//             taskSource: model["DataEngineSource"]
//             taskLabel: visibleName
//             taskIcon: icon
//             activeTask: active
//             minimizedTask: minimized
//             showLabel: true
//             displayMode: "ICON_ASIDE_LABEL"
//             width: test.cellWidth
//             height: test.cellHeight
//         }
    }
    
    
//     PlasmaComponents.Label {
//         id: debug
//         anchors.top: test.bottom
//         text: "tasks sources:\t"+tasksSource.sources+"\ntasks conntected sources:\t"+tasksSource.connectedSources+"\ntasks model count:\t"+tasksModel.count+"\nactivities sources:\t"+activitiesSource.sources+"\nactivities connected sources:"+activitiesSource.connectedSources+"\nactivities model count:\t"+activitiesModel.count
//     }
}